<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateShipmentsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('shipments', function (Blueprint $table) {
            $table->id();
            $table->nullableMorphs('order', 'order');
            $table->unsignedBigInteger('express_id')->comment('快递公司');
            $table->unsignedBigInteger('user_address_id')->comment('收货地址');
            $table->string('tracking_number')->nullable()->comment('物流单号');
            $table->timestamp('shipped_at')->nullable()->comment('发货时间');
            $table->string('status')->default('pending')->comment('状态');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `shipments` comment '发货表'");
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('shipments');
    }
}
